<?php	include_once('../config/db.php');
		include_once('../functions/item.php');
if(!isset($_SESSION['e_logged_in'])) {
header('location:login.php');
}
$list=select_item();
if(isset($_GET['item_id'])){
	 $item_id=$_GET['item_id'];
 	 $delete=mysql_query("DELETE FROM item WHERE `item`. `item_id`='$item_id'");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../style.css" type="text/css"/>
<title>Online Reservation System</title>
</head>
<body>
<div id="header">
<div id="logo">
  <p>&nbsp;</p>
  <div id="apDiv1"><img src="../image/logo.png" alt="" width="500" height="100" /></div>
  <p>&nbsp;</p>
</div>
</div>
<div id="con-body">
<?php include 'navigation.php';?>
<div id="search">
<form id="form1" name="form1" method="post" action="track.php">
   <label for="tracking"></label>
   <input type="text" name="tracking" id="tracking" />
   <input name="button" type="submit" class="blue" id="button" value="Track Materials" />
 </form>
</div>
<p>List of laboratory materias</p>
<?php if(!empty($list)):?>
 <table width="100%" border="0">
 	<thead>
		<tr>
			<th>ID</th>
			<th>Name</th>
			<th>Category</th>
			<th>Serial</th>
			<th>Description</th>
			<th>Status</th>
			<th>Date Added</th>
			<th></th>
		</tr>
	</thead>
	
	<tbody>
		
	    <?php foreach($list as $row):?>
		<tr>
		 <td width="24" bgcolor="#FFFF99"><?php echo $row['item_id'];?></td>
		 <td width="168" bgcolor="#FFFF99"><?php echo $row['item_name'];?></td>
		 <td width="168" bgcolor="#FFFF99"><?php echo $row['category_name'];?></td>
		 <td width="139" bgcolor="#FFFF99"><?php echo $row['item_serial'];?></td>
		 <td width="222" bgcolor="#FFFF99"><?php echo $row['item_desc'];?></td>
		 <td width="104" bgcolor="#FFFF99"><?php echo $row['item_status']?></td>
		 <td width="142" bgcolor="#FFFF99"><?php echo $row['item_date']?></td>
		 <td width="175" bgcolor="#FFFF99"><?php echo'<a href="update.php?item_id='.$row['item_id'].'">Update</a> --<a href="index.php?item_id='.$row['item_id'].'">Delete</a>'; ?></td>
	   </tr>
	    <?php endforeach;?>
	</tbody>
	</table>
	
	 <?php else:?>
	 
	 <div class="notice">No Items available</div>
  
    <?php endif;?> <?php //pagination(); ?></div>
 <p>&nbsp;</p>
 <p>&nbsp;</p>
</body>
</html>